package core
{
	import def.XG;
	
	import flash.display.Sprite;
	import flash.events.ContextMenuEvent;
	import flash.ui.ContextMenu;
	import flash.ui.ContextMenuItem;
	
	public class Menu 
	{
		private var _menu : ContextMenu;
		
		static private var _instance : Menu;
		
		public function Menu()
		{
		
		}
		
		static public function get Instance() : Menu
		{
			if(!_instance)
				_instance = new Menu;
			return _instance;
		}
		
		public function init(root:Sprite):void
		{
			_menu = new ContextMenu;
			_menu.clipboardMenu = false;
			initItems();
		
			root.contextMenu = _menu;
			
			_menu.hideBuiltInItems();
			
		}
		
		private function initItems():void
		{
			var menuItem : ContextMenuItem = new ContextMenuItem("重置");
			
			menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,sleItem);
			
			_menu.customItems.push(menuItem);
		}
		
		private function sleItem(evt : ContextMenuEvent) : void
		{
			trace("-----");
		}
	}
}